package org.taobao.ibatiside.ui.wizard;

import org.eclipse.datatools.modelbase.sql.query.QuerySelectStatement;
import org.eclipse.datatools.modelbase.sql.query.QueryStatement;
import org.eclipse.jface.wizard.IWizardPage;

public class OverviewNewStatementWizard extends BatisCommonWizard {
	//know config, know connection and know map
	//Pages
	SqlBuilderPage sqlBuilderPage;
	DataObjectPage dataObjectPage;
	StatementPage statementPage;
	DaoPage daoPage;
	public OverviewNewStatementWizard() {
		super();
		setNeedsProgressMonitor(true);
	}
	@Override
	public void addPages() {
		sqlBuilderPage = new SqlBuilderPage();
		addPage(sqlBuilderPage);
		dataObjectPage = new DataObjectPage("dataobject_page");
		addPage(dataObjectPage);
		statementPage = new StatementPage("ibatis_statement_PAGE");
		addPage(statementPage);
		daoPage = new DaoPage("ibatis_dao_page");
		addPage(daoPage);
	}
	@Override
	public IWizardPage getNextPage(IWizardPage page) {
		if (page == sqlBuilderPage && (model.getDtpStmt() == null || (model.getDtpStmt() != null && !(model.getDtpStmt() instanceof QuerySelectStatement)))){
			return statementPage;
		}
		return super.getNextPage(page);
	}
	@Override
	public boolean performFinish() {
		return false;
	}
	
}
